package ucuserslogic

import (
	"context"
	"github.com/zeromicro/go-zero/core/logx"
	"navi-mumbai/app/rpc/usercenter/internal/svc"
	"navi-mumbai/app/rpc/usercenter/pb"
	"navi-mumbai/common/utils"
	"navi-mumbai/common/xerr"
)

type DeleteActivityConfigLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDeleteActivityConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteActivityConfigLogic {
	return &DeleteActivityConfigLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 删除活动设置
func (l *DeleteActivityConfigLogic) DeleteActivityConfig(in *pb.DeleteActivityConfigReq) (*pb.DeleteActivityConfigResp, error) {
	defer utils.RecoverPanic()

	err := l.svcCtx.ActivityConfigModel.Delete(l.ctx, in.Id)
	if err != nil {
		return nil, xerr.NewGrpcErrCodeMsg(xerr.DbError, err.Error())
	}
	return &pb.DeleteActivityConfigResp{}, nil
}
